{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Notebook for preparing and saving CYCLES graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import torch\n",
    "import pickle\n",
    "import time\n",
    "import os\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download CYCLES dataset for n=56 and k=6:\n",
    "For preparation for other n and k values, please change values of n and k and re-prepare"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "File already downloaded\n"
     ]
    }
   ],
   "source": [
    "if not os.path.isfile('datasets_kcycle_k=6_nsamples=10000.pickle'):\n",
    "    print('downloading..')\n",
    "    # This dataset original link can be found at: https://github.com/cvignac/SMP\n",
    "    # The pickle file with k=6 is hosted at the below link and will be downloaded\n",
    "    !curl https://www.dropbox.com/s/e1nd889j7vfunnh/datasets_kcycle_k%3D6_nsamples%3D10000.pickle?dl=1 -o datasets_kcycle_k=6_nsamples=10000.pickle -J -L -k\n",
    "    # !unzip cycles.zip -d ../\n",
    "    # !tar -xvf cycles.zip -C ../\n",
    "else:\n",
    "    print('File already downloaded')\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Use the build_dataset() util function adatped from cvignac/SMP\n",
    "from build_cycles import build_dataset\n",
    "build_dataset()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to DGL format and save with pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "os.chdir('../../') # go to root folder of the project\n",
    "print(os.getcwd())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using backend: pytorch\n",
      "WARNING:root:The OGB package is out of date. Your version is 1.2.3, while the latest version is 1.3.1.\n"
     ]
    }
   ],
   "source": [
    "import pickle\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from data.cycles import CyclesDatasetDGL \n",
    "\n",
    "from data.data import LoadData\n",
    "from torch.utils.data import DataLoader\n",
    "from data.cycles import CyclesDataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "DATASET_NAME = 'CYCLES'\n",
    "n = 56\n",
    "k = 6\n",
    "dataset = CyclesDatasetDGL(DATASET_NAME, n=n, k=k) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEICAYAAABWJCMKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAT+klEQVR4nO3df7Bc5X3f8fenomb8A2wcXagsQYQ9sltgYtloCBmPXVLSQMC1cFu3oo1NXFqBBzrJxJ0U+mPMeKqWuqFOmMQ4YFQgtaFKCIEW7BqTTphObeMrrOGnqQXI6CJFurHjGMce1RLf/rFHZSvv1ZV2996F+7xfMzt79nt+PY+Pxeee55w9m6pCktSevzTpBkiSJsMAkKRGGQCS1CgDQJIaZQBIUqMMAElqlAEgzSPJp5P860m3Qxq3+D0ALXVJdgD/uKq+NOm2zOWV0EYtPZ4BqGlJjpl0G6RJMQC0pCX5XeAU4L8m+X6SX0tSSS5N8hzwR91yv5fkT5L8eZIHk5zet41bkvybbvqcJDNJPppkb5LdST7ct+wFSZ5I8kKS55P8s755702yLcl3k/yvJD81VxsX5X8cNc8A0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Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 38 64\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAO1klEQVR4nO3dfayedX3H8ffHoizxIUBaGqToQdO44R9W06GGzaFs8mRWTIapZktjSMofsGmyZCvuD/2nSV3mHCbqUhVtNiurOEIzjIN0D2bLUIozClRihQqHVlofyHBuLJTv/jgX8Vjv03N67nP3tF/er+Tkuq/f9XB/f/m1n/t3rt7X1VQVkqReXrDcBUiSlp7hLkkNGe6S1JDhLkkNGe6S1JDhLkkNGe7SMZJcmmR6ueuQxmG4SxOQZCpJJTljuWvR85PhLkkNGe5qK8mWJLcd03Zzko8leW+SfUmeSvJwkuuPc54/TfL4sO9DSS4b2l8wvMf3kvwoya4k5wyHfXVYPpnkp0nePJleSqMZ7ursC8BVSV4GkGQF8C5gJ3AYeAfwMuC9wEeTvOHYEyR5DXAj8OtV9VLgcuDAsPmPgGuA3wJeDvwE+Piw7S3D8qyqeklV/ceS9046DsNdbVXV94FvMBPAAG8DflZV91TVnVX1vZrxr8BdwG+OOM1R4EzgoiQvrKoDVfW9Ydv1wJ9V1XRVPQ18CPg9r7PrVGC4q7udwLuH1+8Z1klyZZJ7kvw4yZPAVcDKYw+uqv3A+5kJ7sNJbk3y8mHzK4Hbkzw5nGMfMx8GqyfZIWkhDHd190Xg0iRrgHcCO5OcCXwJ+AtgdVWdBXwZyKgTVNXOqvoNZsK8gA8Pmx4Drqyqs2b9/EpVPT7sJy0bw12tVdUR4F+AzwKPVNU+4EXMXGo5AjyT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Ndkhoy3CWpIcNdkhoy3CWpIcNdkhr6f923QrmKArPRAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 38 65\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAVRklEQVR4nO3df7DldX3f8ecrGKkhUqFcmXWXza7OogEmWeWW4BAtKTEQMILpoMtUwYR2lWKrU9sUbGe07eyUJhIbx4pdlABGwR0JgRb8gSSjzQSECxJg+VFXWOWym91VtGLMbLPLu3+c79WTy7m7d+859yzcz/Mxc+Z8z/t8f3w+fLmv893P+Z7vN1WFJKkNP3WwGyBJGh9DX5IaYuhLUkMMfUlqiKEvSQ0x9CWpIYa+JDXE0FdTkmxN8qtDruMdSf78udIe6UAY+pLUEENfzUjyKWAl8D+T/DDJ7yQ5OclfJPl+kr9Mcmrf/O9I8liSp5M8nuSfJvl54OPAa7t1fL+b98wkD3XzPpnk3/St541J7uu28RdJfmGu9ozxP4caFS/DoJYk2Qr8s6r6cpLlwP3A24EvAKcB1wOvAn4EbAf+YVU9mmQZcGRVbU7yjm4dv9y33u3AW6rqfyc5AlhdVfcmeU237t8ApoC3Af8ReGVV7e5vzzj6L3mkr5a9Dbi1qm6tqmeq6jZ6wXxm9/4zwAlJXlRV26tq8z7W9bfAcUkOr6rvVdW9Xf2fA/+jqr5WVXur6hpgN3DyIvVJ2idDXy37OeDcbtjl+91QzS8Dy6rqr4G3Au8Ctie5Jcmr9rGuf0Lvw+JbSb6S5LV923jfrG0cA7xs0Xol7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TVzQzXYBcNNBauLIzNXXmT+YzpuBBw9KA0coyWFJXjwzDfwavX4tqf06Vz+X4j6tqr8Cnkjyyq50Gr3LvC+pfTrb2O+c1bDLgE1JLgS+DZx7kNuzmH43yVp6Y8NbgXce3OaMxNHAjUmg93fzmar6QpK7WVr7da5+fmoJ7lOAfwl8ursW2GPAb9E7GF5K+/Tv8DIMktQQh3ckqSGGviQ1xNCXpIYY+pLUEENfkhpi6EtSQwx9SWrI/wc6W6SiWxJzlwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 37 63\n"
     ]
    }
   ],
   "source": [
    "def plot_histo_graphs(dataset, title):\n",
    "    # histogram of graph sizes\n",
    "    graph_sizes = []\n",
    "    for graph in dataset:\n",
    "        graph_sizes.append(graph[0].number_of_nodes())\n",
    "    plt.figure(1)\n",
    "    plt.hist(graph_sizes, bins=20)\n",
    "    plt.title(title)\n",
    "    plt.show()\n",
    "    graph_sizes = torch.Tensor(graph_sizes)\n",
    "    print('min/max :',graph_sizes.min().long().item(),graph_sizes.max().long().item())\n",
    "    \n",
    "plot_histo_graphs(dataset.train,'trainset')\n",
    "plot_histo_graphs(dataset.val,'valset')\n",
    "plot_histo_graphs(dataset.test,'testset')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9000\n",
      "1000\n",
      "10000\n",
      "(Graph(num_nodes=44, num_edges=68,\n",
      "      ndata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float32)}\n",
      "      edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float32)}), tensor([0]))\n",
      "(Graph(num_nodes=50, num_edges=92,\n",
      "      ndata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float32)}\n",
      "      edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float32)}), tensor([0]))\n",
      "(Graph(num_nodes=46, num_edges=76,\n",
      "      ndata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float32)}\n",
      "      edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float32)}), tensor([0]))\n"
     ]
    }
   ],
   "source": [
    "print(len(dataset.train))\n",
    "print(len(dataset.val))\n",
    "print(len(dataset.test))\n",
    "\n",
    "print(dataset.train[0])\n",
    "print(dataset.val[0])\n",
    "print(dataset.test[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 7.550283193588257\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "with open('data/cycles/CYCLES'+'_'+str(k)+'_'+str(n)+'.pkl','wb') as f:\n",
    "        pickle.dump([dataset.train,dataset.val,dataset.test],f)\n",
    "print('Time (sec):',time.time() - start)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test load function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[I] Loading dataset CYCLES...\n",
      "train, test, val sizes : 9000 10000 1000\n",
      "[I] Finished loading.\n",
      "[I] Data load time: 9.1989s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'CYCLES'\n",
    "dataset = LoadData(DATASET_NAME)\n",
    "trainset, valset, testset = dataset.train, dataset.val, dataset.test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'data.cycles.CyclesDataset'>\n"
     ]
    }
   ],
   "source": [
    "batch_size = 10\n",
    "collate = CyclesDataset.collate\n",
    "print(CyclesDataset)\n",
    "train_loader = DataLoader(trainset, batch_size=batch_size, shuffle=True, collate_fn=collate)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
